package com.eightywork.life.fragment;

import com.eightywork.life.R;
import com.eightywork.life.activity.BaseActivity;
import com.eightywork.life.activity.RegFirstActivity;
import com.eightywork.life.service.CacheService;
import com.eightywork.life.widget.ActionsContentView;
import com.umeng.analytics.MobclickAgent;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

public class BaseFragment extends Fragment {
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
	}
	

	public BaseActivity getBaseActivity() {
		return (BaseActivity) getActivity();
	}

	public void initHeader(String headerText,
			final ActionsContentView viewActionsContentView) {

		TextView headrTitleView = (TextView) getView().findViewById(
				R.id.header_title);
		headrTitleView.setText(headerText);
		ImageView imageView = (ImageView) getView().findViewById(
				R.id.button_left);
		imageView.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				if (viewActionsContentView.isActionsShown()) {
					viewActionsContentView.showContent();
				} else {
					viewActionsContentView.showActions();
				}
			}
		});
	}
	
	@Override
	public void onResume() {
		super.onResume();
	    MobclickAgent.onResume(getActivity());
	}
	
	@Override
	public void onPause() {
	    super.onPause();
	    MobclickAgent.onPause(getActivity());
	}
	
}
